<?php
error_reporting("E_ALL");
#基础函数
include_once('_path.php');
#taobao
include_once(_CONST_LOCAL_INCLUDE_PATH."/top/RequestCheckUtil.php");
include_once(_CONST_LOCAL_INCLUDE_PATH."/top/ItemGetRequest.php");
include_once(_CONST_LOCAL_INCLUDE_PATH."/top/TopClient.php");

$array = array('item.taobao.com', 'detail.tmall.com');
$url2 = "http://detail.tmall.com/item.htm?spm=1103GSGc.1-300qn.3-556igi&id=13588279302&prt=1324617222589&prc=2";
$url = "http://item.taobao.com/item.htm?spm=11040SxD.1-6ySNm.b-3avrgI&id=13324427816";
foreach($array as $u)
{
	if(preg_match("#$u#i", $url))
	{
		if(preg_match("#id=([0-9]+)#i", $url, $match))
		{
			$c = new TopClient;
			$c->format = 'json';
			$c->appkey = TB_AKEY;
			$c->secretKey = TB_SKEY;
			$req = new ItemGetRequest;
			$req->setFields("num_iid,title,item_img");
			$req->setNumIid($match[1]);
			$resp = $c->execute($req, $sessionKey);
			
			print_r($resp);

			exit;
		}
	}
}

?>